package com.lawrence.controller;

import com.lawrence.common.except.CustomException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 统一异常练习
 * @author wanglanglang
 */
@RestController
@Api(tags = "统一异常练习")
public class ExceptionController {
    @GetMapping("/except")
    @ApiOperation(value = "统一异常练习")
    public String exception(Integer num) {
        if (num == null) {
            throw new CustomException(400, "num不能为空");
        }
        int i = 10 / num;
        return "result:" + i;
    }
}
